sdtexture module

class sd.api.sdtexture.SBSPixelFormat

Bases: enum.Enum

An enumeration.

BGR8 = 4
BGRA8 = 6
LUM16 = 7
LUM16F = 11
LUM32F = 15
LUM8 = 1
LUMALPHA16 = 8
LUMALPHA16F = 12
LUMALPHA32F = 16
LUMALPHA8 = 2
RGB16 = 9
RGB16F = 13
RGB32F = 17
RGB8 = 3
RGBA16 = 10
RGBA16F = 14
RGBA32F = 18
RGBA8 = 5
Unknown = 0
class sd.api.sdtexture.SDTexture(APIContext, handle, *args, **kwargs)

Bases: sd.api.sdapiobject.SDAPIObject

Common 2D texture object (i.e. a 2d array of pixels)

getBytesPerPixel() → int

Get the bytes count per pixel

getClassName() → str

Returns the most specific name of the class this APIObject is

getPixelBufferAddress() → int

Get the address of the pixel buffer in memory. Take in account the Row pitch that can be negative. In this case the pixel values will be located before this address in memory.

getPixelFormat() → sd.api.sdtexture.SBSPixelFormat

Get the pixel format of the texture (see SBSPixelFormat)

getRowPitch() → int

Get the offset between adjacent scanlines, in bytes. This Value can be negative. In this case, all the pixel values will be located before the pixel buffer address.

getSize() → sd.api.sdbasetypes.int2

Get the size of the texture

release() → None

Releases an APIObject

static sFromFile(filename: str) → Optional[sd.api.sdtexture.SDTexture]

Create a new texture from the specified file

Parameters

filename – The image absolute file path

save(filename: str, outputColorSpace: str = '') → None

Save the current texture to the specified file

Parameters
  • filename – The absolute file path used to save the texture

  • outputColorSpace – The destination color space name. If empty, no color transform is applied